package repositories;

import java.util.Collection;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import domain.Route;

@Repository
public interface RouteRepository extends JpaRepository<Route, Integer>{
	
	@Query("select e.routes from Event e where e.id=?1")
	Collection<Route> findRoutesByEvent(int id);
	
	//Busca todas las rutas creadas por un administrador
	@Query("select e.routes from Administrator a join a.events e where a.id=?1")
	Collection<Route> findAllByAdmin(int id);

}
